package com.mp3s.plugin_quote;

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

public class quote {

    private List<String> stockList = new ArrayList<>();

    public List<String> getStockList(){
        return stockList;
    }

    public void load_stocks(){
        // 加载stock列表：stock_sz.txt,stock_sh.txt

		//读取本地配置*.txt
		String fileName = "stock_sz.txt"; // 同级目录下的文件
        try (BufferedReader br = new BufferedReader(new FileReader(fileName))) {
            String line;
            while ((line = br.readLine()) != null) {
                // System.out.println(line);
				stockList.add(line);
            }
        } catch (IOException e) {
            e.printStackTrace();
        }

        //读取本地配置*.txt
		fileName = "stock_sh.txt"; // 同级目录下的文件
        try (BufferedReader br = new BufferedReader(new FileReader(fileName))) {
            String line;
            while ((line = br.readLine()) != null) {
                // System.out.println(line);
				stockList.add(line);
            }
        } catch (IOException e) {
            e.printStackTrace();
        }

    }
}
